/*
 * @Author: 陈国庆 2306727047@qq.com
 * @Date: 2023-12-09 11:00:53
 * @LastEditors: 陈国庆 2306727047@qq.com
 * @LastEditTime: 2023-12-13 11:14:41
 * @FilePath: \boke7.0\boke-server\src\user\user.controller.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Controller, Get, Req, Query, UseGuards } from '@nestjs/common';
import { UserService } from './user.service';
import { Request } from 'express';
import { Res } from 'src/utils/Res';
import { roleService } from 'src/role/role.service';
import { AuthGuard, Public } from 'src/auth/auth.guard';

@Controller('user')
export class UserController {
  constructor(
    private readonly appService: UserService,
    private readonly roleService: roleService,
  ) {}

  @Get('/app')
  Hello() {
    return this.appService.findAll();
  }
  /**
   *
   * @param query 用户
   * @returns
   */
  @UseGuards(AuthGuard)
  @Get('/getUserInfo')
  async Go(@Query() query: Request['query']) {
    const { userId } = query as unknown as {
      userId: number;
    };
    return this.appService.findOne(userId);
  }
}
